<script setup>
// vue2 this.$router.push('/')
// router 路由实例
// route 当前路由对象
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()

const goHome = () => {
  router.push('/')
}
const goLogin = () => {
  router.push('/login?a=123')
}
</script>

<template>
  <h1>Hello vue3</h1>
  <ul>
    <li>
      <RouterLink to="/">首页</RouterLink>
    </li>
    <li>
      <RouterLink to="/login?a=123">登录页</RouterLink>
    </li>
    <button @click="goHome">去首页</button>
    <button @click="goLogin">去登录页</button>
  </ul>

  <!-- 路由出口 -->
  <RouterView></RouterView>
</template>
